<script setup>
import {ref, nextTick} from "vue";

const textRef = ref(1);

async function asyncAdd() {
  textRef.value++;
  console.log(document.getElementById("1").textContent);
  await nextTick();
  console.log(document.getElementById("1").textContent);

}

</script>

<template>
  <h2>控制异步回调，避免组件每一次触发都及时刷新</h2>
  <div id="1">记录变化的值 {{ textRef }}</div>
  <button @click="textRef++">trig test</button>
</template>

<style scoped>

</style>